MenuNumber specifies the pop-up menu number (from 1 to 255) that is affected in the current window. If the current window doesn’t belong to your application, or if the specified pop-up menu doesn’t exist, InsertPopUpItem does nothing.
ItemNumber specifies the pop-up menu’s item number (from 1 to 255) where the item is inserted. If the pop-up menu item does not exist in the specified pop-up menu, InsertPopUpItem does nothing. InsertPopUpItem will append one item to the end of a pop-up menu if the ItemNumber equals the current number of items plus 1.
EnabledFlag specifies whether the item is enabled or disabled. In the enabled state, the item can be selected whereas in the disabled state, the item is dimmed and cannot be selected by the user. The two constants that can be used for this purpose are enabled and disabled. An entire pop-up menu and individual pop-up menu items can be enabled and disabled by using the EnablePopUp procedure.
MenuText is the name of the item. Certain metacharacters are recognized by Tools Plus to provide special instructions to the Menu Manager. You may choose to include or exclude these characters within MenuText, however, you should be aware of their effects. See the PopUpMenu procedure for details on metacharacters.
When the item is inserted, all existing items starting at ItemNumber are pushed down one space to make room for the new item. This means that their item number will be changed. The new item is inserted at the location specified by ItemNumber. The main use for this procedure is to let your application maintain a dynamic menu, such as a list of open document names.
Note: The Macintosh’s Menu Manager allows only the first 31 items of a
pop-up menu to be disabled individually. The entire pop-up menu,
MenuNumber specifies the pop-up menu number (from 1 to 255) that is affected in the current window. If the current window doesn’t belong to your application, or if the specified pop-up menu doesn’t exist, RemovePopUp does nothing.
ItemNumber specifies the pop-up menu’s item number (from 1 to 255) that is deleted. If ItemNumber is zero (0), RemovePopUp refers to the pop-up menu and all its associated items. If ItemNumber is not zero and it does not exist, RemovePopUp does nothing.
Note: Use RemovePopUp to maintain a dynamic menu, such as a list of
available font sizes. Do not use it to make items unavailable.
MenuNumber specifies the pop-up menu number (from 1 to 255) that is affected in the current window.
ItemNumber specifies the pop-up menu item number (from 1 to 255) from which the text is obtained.
MenuText specifies the pop-up menu item’s name. If the specified pop-up menu does not exist in the current window, or the specified item doesn’t exist, MenuText returns as a null string (length is zero). Note that the string will return as a single space (‘ ’) if a null string was specified when the item was created (this happens automatically to prevent the Menu Manager from crashing).
MenuNumber specifies the pop-up menu number (from 1 to 255) that is affected in the current window. If the current window doesn’t belong to your application, or if the specified pop-up menu doesn’t exist, RenamePopUp does nothing.
ItemNumber specifies the menu item number (from 1 to 255) which is changed. If the item number does not exist within the pop-up menu specified by MenuNumber, RenamePopUp does nothing.
MenuText specifies the pop-up menu item’s new name. The item’s state (enabled/disabled), style (bold, underline, etc.), icon and command key equivalent are not changed. Metacharacters are not interpreted by this procedure.
RenamePopUp does not change the pop-up menu’s title. If the pop-up menu’s title must be changed, the affected pop-up menu must be removed with the RemovePopUp procedure, then re-created as required by using the NewPopUp procedure.
MenuNumber specifies the pop-up menu number (from 1 to 255) that is affected in the current window. If the current window doesn’t belong to your application, or if the specified pop-up menu doesn’t exist, EnablePopUp does nothing.
ItemNumber specifies the menu item number (from 1 to 255) which is enabled/disabled. A value of zero (0) affects the entire pop-up menu. If ItemNumber is not zero and the item number does not exist within the menu specified by MenuNumber, EnablePopUp does nothing.
EnabledFlag specifies whether the pop-up menu/item is enabled or disabled. In the enabled state, the menu/item can be selected. The two constants that can used for this purpose are enabled and disabled. If the ItemNumber is zero, the entire pop-up menu is disabled and the items cannot be viewed. When the pop-up menu later becomes enabled, all items in the pop-up menu assume their correct enabling/disabling as specified by your application.
Note: The Macintosh’s Menu Manager allows only the first 31 items of a
pop-up menu to be disabled individually. The entire pop-up menu,
Determine if a pop-up menu is enabled or disabled.
pascal Boolean PopUpIsEnabled (short MenuNumber);
function PopUpIsEnabled (MenuNumber: INTEGER): BOOLEAN;
MenuNumber specifies the pop-up menu number (from 1 to 255) which is queried in the current window.
The function’s value returns true if the pop-up menu is enabled, and false if the pop-up menu is disabled. If the current window doesn’t belong to your application, or if no windows are open, or if the pop-up menu does not exist in the current window, PopUpIsEnabled returns false.
CONST {Menu and Menu Item status }
enabled = true; {enable the menu/item }
disabled = false; {disable the menu/item }
Note: PopUpIsEnabled returns the pop-up menu’s state as though the pop-
up menu’s window is active. This is the case even when the window
is deactivated and all the pop-up menus appear disabled.
MenuNumber specifies the pop-up menu number (from 1 to 255) that is affected in the current window. If the current window doesn’t belong to your application, or if the specified pop-up menu doesn’t exist, CheckPopUp does nothing.
ItemNumber specifies the pop-up menu item number (from 1 to 255) that is affected. If the item number does not exist within the pop-up menu specified by MenuNumber, CheckPopUp does nothing.
Checked specifies whether the pop-up menu item’s check mark is displayed or hidden. The two constants that can be used for this purpose are on and off. By default, pop-up menus can have only one item selected at a time. Therefore, placing a check mark beside an item unchecks the previously checked item. See the NewPopUp procedure if you want to override this behavior.
To display characters other than the standard check mark, use the PopUpMark procedure.
Display or hide a special character to the left of a pop-up menu item’s name. Use this procedure instead of CheckPopUp to display or hide characters other than the standard check mark.
pascal void PopUpMark (short MenuNumber, short ItemNumber,
MenuNumber specifies the pop-up menu number (from 1 to 255) that is affected in the current window. If the current window doesn’t belong to your application, or if the specified pop-up menu doesn’t exist, PopUpMark does nothing.
ItemNumber specifies the pop-up menu item number (from 1 to 255) that is affected. If the item number does not exist within the pop-up menu specified by MenuNumber, PopUpMark does nothing.
MarkChar specifies the character that is to be displayed. By default, pop-up menus can have only one item selected at a time. Therefore, placing a mark beside an item unmarks the previously marked item. See the NewPopUp procedure if you want to override this behavior. The following constants are available for pop-up menu marks:
CONST {Menu Item characters }
AppleChar = char($14); {Apple character }
CheckChar = char($12); {Check Mark character }
DiamondChar = char($13); {Diamond character }
DotChar = char($A5); {Dot (or bullet) character }
NoChar = char($00); {No character (remove a character) }
MenuNumber specifies the pop-up menu number (from 1 to 255) in the current window that contains the desired item.
ItemNumber specifies the pop-up menu item number (from 1 to 255) whose mark character is obtained.
MarkChar contains the “mark” character that is displayed to the left of the item’s name. If no mark is displayed by the specified pop-up menu item, or if the specified pop-up menu or item doesn’t exist, MarkChar is set to null (char(0)). The following are useful constants for testing menu marks:
CONST {Menu Item characters }
AppleChar = char($14); {Apple character }
CheckChar = char($12); {Check Mark character }
DiamondChar = char($13); {Diamond character }
DotChar = char($A5); {Dot (or bullet) character }
NoChar = char($00); {No character (remove a character) }
MenuNumber specifies the pop-up menu number (from 1 to 255) that is affected in the current window. If the pop-up menu does not exist, PopUpIcon does nothing.
ItemNumber specifies the pop-up menu item number (from 1 to 255) that is affected. If the item number does not exist within the pop-up menu specified by MenuNumber, PopUpIcon does nothing.
IconSelector identifies the icon that is used, and should be from 1 to 255. The Menu Manager adds 256 to the number you state to specify a resource ID that is in the range of 257 to 511, so if you specify 28, resource ID 284 is used (28 + 256 = 284). These icon resources are read from your application. If Color QuickDraw is available on the Macintosh running your application, a ‘cicn’ (color) icon is used. If a ‘cicn’ is not available (or Color QuickDraw is unavailable), an ‘ICON’ or ‘SICN’ is used. Use zero (0) if you don’t want an icon displayed.
Unlike the equivalent Macintosh toolbox routine, your menu item will remain unaffected if the specified icon can’t be found (i.e, empty space is not reserved in the menu).
Be aware that the Menu Manager drawing a ‘cicn’ icon in color will do so even if the icon was created using 8-bit colors and the monitor is set to 4-bits. This may produce unsatisfactory results. If possible, use 4-bit colors or colors that translate well into 4-bit colors.
MenuNumber specifies the pop-up menu number (from 1 to 255) that is affected in the current window that contains the desired menu item.
ItemNumber specifies the pop-up menu item number (from 1 to 255) whose icon number is obtained.
IconSelector contains the item’s icon number. The Menu Manager automatically adds 256 to the IconSelector you specify, so an IconSelector of 28 means that resource ID 284 is used (28 + 256 = 284). If an icon is not displayed by the specified pop-up menu item, IconSelector will be equal to zero.
MenuNumber specifies the pop-up menu number (from 1 to 255) that is affected in the current window. If the pop-up menu does not exist, PopUpStyle does nothing.
ItemNumber specifies the pop-up menu item number (from 1 to 255) that is affected. If the item number does not exist within the pop-up menu specified by MenuNumber, PopUpStyle does nothing.
TheStyle specifies the style(s) in which the pop-up menu item is to be displayed. Special character constants defined by the Font Manager are bold, italic, underline and shadow. C programmers will use the font manager’s constants to specify a composite style, such as PopUpStyle(1,1, bold + outline) for bold and outlined, or PopUpStyle(1,1,0) for plain text. Pascal programmers will use the font manager’s constants to specify a set, such as PopUpStyle(1,1,[bold,outline]) for bold and outlined, or PopUpStyle(1,1,[]) for plain text.
pascal short GetPopUpSelection (short MenuNumber);
function GetPopUpSelection (MenuNumber: INTEGER): INTEGER;
MenuNumber specifies the pop-up menu number (from 1 to 255) you wish to query in the current window.
The function’s value returns the number of the pop-up menu item that is selected by having a “mark” (check mark or otherwise) beside it. If you have defined your pop-up menu to allow multiple selections, PopUpItemCount returns the number of the first selected item. If the pop-up menu number does not exist, the function returns zero.